//
//  XHRewardListViewController.m
//  XHAdSDKTest
//
//  Created by 陈俭红 on 2022/2/16.
//

#import "XHRewardListViewController.h"

//广告头文件
#import <XHAdSDK/XHAdSDK.h>

@interface XHRewardListViewController ()<XHRewardAdDelegate>

@property (nonatomic, strong)UIButton * normalBtn;
/* <#name#> */
@property (nonatomic, strong) XHAdCenter *center;

@end

@implementation XHRewardListViewController

//MARK: Cycle Methods
- (void)viewDidLoad{
    [super viewDidLoad];
    
    self.title = @"激励广告";
    
    [self addAllViews];
}

//MARK: Custom Methods
- (void)addAllViews{
    [self.view addSubview:self.normalBtn];
}

//MARK: Getter Methods
- (UIButton *)normalBtn{
    if (!_normalBtn) {
        _normalBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _normalBtn.frame = CGRectMake((self.view.frame.size.width - 150) / 2, 100, 150, 44);
        [_normalBtn setTitle:@"激励广告" forState:UIControlStateNormal];
        [_normalBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        _normalBtn.backgroundColor = [UIColor purpleColor];
        [_normalBtn addTarget:self action:@selector(playBtnAction) forControlEvents:UIControlEventTouchUpInside];
    }
    return _normalBtn;
}

- (void)playBtnAction {
    XHAdCenter * center = [XHAdCenter new];
    XHRewardAdData * data = [XHRewardAdData new];
    data.rootViewController = self;
    data.rewardAdDelegate = self;
    data.isPreload = YES;   //是否预加载 默认NO
    data.user_id = @"1";
    [center xh_showRewardAd:data appId:@"248200204069634093"];
    self.center = center;
}

- (void)xh_onRewardAdDidLoad {
    NSLog(@"广告预加载成功");
    [self.center xh_showPreloadRewardAd];
}

/** 广告加载失败，msg加载失败说明（如果重新请求广告，注意：只重新请求一次）*/
- (void)xh_onRewardAdFail:(NSString *)errorString{
    
}

/** 视频被点击 */
- (void)xh_onRewardAdClicked{
    
}

/** 视频被关闭 */
- (void)xh_onRewardAdClose{
    
}

/** 视频广告曝光 */
- (void)xh_onRewardAdExposure{
    
}

/** 视频广告加载完成，此时播放视频不卡顿 */
- (void)xh_onRewardVideoCached{
    
}

/** 激励视频触发激励（观看视频大于一定时长或者视频播放完毕）*/
- (void)xh_onRewardVerify{
    
}
@end
